package planit.controller.impl;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

import planit.model.Model;
import planit.view.DeleteEventDialog;

@SuppressWarnings("serial")
public class DeleteEventController extends AbstractAction {
	private Model model;

	public DeleteEventController(Model model) {
		this.model = model;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		DeleteEventDialog dialog = (DeleteEventDialog)this.getValue("DeleteEventDialog");

		model.getSchedule().removeEvent(
				model.getSchedule().getEvent(dialog.getEventId()));
		dialog.updateEventList();
	}

}
